package com.app.repository.impl;

import com.app.model.main.MeetRecord;
import com.app.repository.interfaces.MeetRecordMapper;
import com.app.support.dao.MybatisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Lichaojie on 2017/5/7. It's a beautiful day.
 */
@Repository
public class MeetRecordMapperImpl implements MeetRecordMapper {

    private String prefix = "com.app.dao.main.MeetRecordMapper";

    @Autowired
    private MybatisDao mybatisDao;

    @Override
    public int deleteByPrimaryKey(Long id){
        return mybatisDao.delete(prefix,".seleteByPrimaryKey",id);
    }

    @Override
    public int insert(MeetRecord record){
        return mybatisDao.insert(prefix,".insert",record);
    }

    @Override
    public int insertSelective(MeetRecord record){
        return mybatisDao.insert(prefix,".insertSelective",record);
    }

    @Override
    public MeetRecord selectByPrimaryKey(Long id){
        return mybatisDao.get(prefix,".selectByPrimaryKey",id);
    }

    @Override
    public int updateByPrimaryKeySelective(MeetRecord record){
        return mybatisDao.update(prefix,".updateByPrimarySelective",record);
    }

    @Override
    public int updateByPrimaryKey(MeetRecord record){
        return mybatisDao.update(prefix,".updateByPrimaryKey",record);
    }

    @Override
    public List<MeetRecord> selectByReceiverIdBetween(long receiverId, String time1, String time2){
        Map<String,Object> map = new HashMap<>();
        map.put("receiverId",receiverId);
        map.put("time1",time1);
        map.put("time2",time2);
        return mybatisDao.getList(prefix,".selectByReceiverId",map);
    }
}
